/**
 * 验证工具JS 
 */

/**
 * 验证非空
 */
function validateEmpty(id) {

		var ele = document.getElementById(id);
		var tip = document.getElementById(id+"_msg");
		var value = ele.value;
		if(value!=null && value!="") {
			ele.className = "right";
			if( tip!=null) {
				tip.innerHTML = "<font color='#00FF00'>验证通过</font>";
			}
			return true;
		}else{
			ele.className = "wrong";
			if( tip!=null) {
				tip.innerHTML = "<font color='#FF0000'>验证非法</font>";
			}
			return false;
		}
}

/**
 * 验证正则
 */
function validateRegex(id,regex) {

	var ele = document.getElementById(id);
	var tip = document.getElementById(id+"_msg");
	var value = ele.value;
	if(regex.test(value)) {
		ele.className = "right";
		if( tip!=null) {
			tip.innerHTML = "<font color='#00FF00'>验证通过</font>";
		}
		return true;
	}else{
		ele.className = "wrong";
		if( tip!=null) {
			tip.innerHTML = "<font color='#FF0000'>验证非法</font>";
		}
		return false;
	}
	
	
}
